Skip to content

Conversation

bachuv
Copy link
Contributor

@bachuv bachuv commented Jul 16, 2025

This PR adds support to add Invocation Id information to Module Private Data so we can use it for distributed tracing in Start-DurableOrchestration.

It is dependent on changes in the Functions PowerShell OpenTelemetry SDK: Azure/azure-functions-powershell-opentelemetry#25

Application Insights example (using the instructions in Use OpenTelemetry with Azure Functions):

image

host.json

{
  "version": "2.0",
  "telemetryMode": "OpenTelemetry",
  "extensions": {
    "durableTask": {
      "tracing": {
        "distributedTracingEnabled": true,
        "version": "V2"
      }
    }
  }
}

local.settings.json

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "",
    "FUNCTIONS_WORKER_RUNTIME_VERSION": "7.4",
    "FUNCTIONS_WORKER_RUNTIME": "powershell",
    "ExternalDurablePowerShellSDK": "true",
    "OTEL_FUNCTIONS_WORKER_ENABLED": "true",
    "APPLICATIONINSIGHTS_CONNECTION_STRING": "<connection string>"
  }
}

profile.ps1

Import-Module AzureFunctions.PowerShell.OpenTelemetry.SDK
Initialize-FunctionsOpenTelemetry

@bachuv bachuv self-assigned this Jul 16, 2025
@bachuv bachuv requested review from andystaples and AnatoliB July 16, 2025 23:34
@bachuv bachuv changed the title Add Invocation Id to Module Private Data Add Invocation Id to Set-FunctionInvocationContext and propagate trace information in HTTP requests to correlate client and orchestration functions Aug 14, 2025
@bachuv bachuv marked this pull request as ready for review August 14, 2025 23:28
@bachuv bachuv requested a review from AnatoliB August 14, 2025 23:37
AnatoliB
AnatoliB previously approved these changes Aug 16, 2025
Copy link
Collaborator

@AnatoliB AnatoliB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@AnatoliB
Copy link
Collaborator

@bachuv But please make sure the tests pass :-)

andystaples
andystaples previously approved these changes Aug 18, 2025
@bachuv bachuv dismissed stale reviews from andystaples and AnatoliB via 6c92a83 August 27, 2025 22:07
@bachuv bachuv merged commit ca16f78 into main Aug 29, 2025
2 checks passed
@bachuv bachuv deleted the vabachu/add-invocation-id-to-private-data branch August 29, 2025 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants